package app.caihan.wanandroid.ui.find

import android.os.Bundle
import app.caihan.scframe.databind.DataBindingConfig
import app.caihan.scframe.util.StatusBarConfig
import app.caihan.wanandroid.BR
import app.caihan.wanandroid.R
import app.caihan.wanandroid.base.WanBaseFragment

/**
 *
 *
 * @author Seven-C
 * @date 2020/10/17
 */
class KnowledgeListFragment : WanBaseFragment<KnowledgeListFragmentModel>(){

    private val type by lazy { arguments?.getInt(TYPE) }

    companion object {
        private const val TYPE = "type"
        fun newInstance(type: Int): KnowledgeListFragment {
            val fragment = KnowledgeListFragment()
            val bundle = Bundle()
            bundle.putInt(TYPE, type)
            fragment.arguments = bundle
            return fragment
        }
    }

    override fun bindLayoutId(): Int {
        return R.layout.fragment_knowledge_list
    }

    override fun getDataBindingConfig(): DataBindingConfig {
        return DataBindingConfig(BR.vm)
    }

    override fun getStatusBarConfig(): StatusBarConfig? {
        return null
    }

    override fun initView(savedInstanceState: Bundle?) {
    }

    override fun createObserver() {
    }

    override fun lazyLoadData() {
        type?.let {
            mViewModel.autoRefresh(it)
        }
    }
}